package com.apes.scm.masterdata.frame.service;

import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.scm.masterdata.frame.model.ConsignmentSpecial;
import com.apes.scm.masterdata.frame.repository.ConsignmentSpecialRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @ClassName : ConsignmentSpecialService
 * @Description : 业务层
 * @Author : WSJ
 * @Date: 2020-04-09 14:51
 */
@Service("consignmentSpecialService")
public class ConsignmentSpecialService extends DomainService {
    @Autowired
    private ConsignmentSpecialRepository consignmentSpecialRepository;

    public ConsignmentSpecial save(SimpleRequest request) {
        ConsignmentSpecial consignmentSpecial = request.getO(ConsignmentSpecial.class);
        return consignmentSpecialRepository.saveAndFlush(consignmentSpecial);
    }

    public String delete(SimpleRequest request) throws Exception  {
        ConsignmentSpecial consignmentSpecial = request.getO(ConsignmentSpecial.class);
        consignmentSpecial.setDeleteDate(new Date());
        consignmentSpecial.setDeleteUid(this.getPerson(request));
        consignmentSpecialRepository.saveAndFlush(consignmentSpecial);
        return "删除成功";
    }
}
